home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
suncom.zip
/
SUNCOM.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1990-02-24
|
61KB
|
1,613 lines
{$R-,V-,S-}
PROGRAM SUN_Comm;
{$M 40000,0,45000}
USES
Crt, Dos, GlobType, PibTimer, PibAsync, Windows,
Ansidrv, Tpz, MyDos, TpStack, Printer;
CONST Max = 150;
MaxBuffer = 7168;
MaxBufferLimit = 6656;
Esc = #27;
On = 1;
Off = 0;
Pause = 2;
Send = 1;
Receive = 0;
Open_Close : array[0..2] of String[5]
= ('Close','Open ','Pause');
On_Off : array[0..1] of String[3]
= ('OFF ','ON');
Yes_No : array[0..2] of String[3]
= ('N','Y','Y');
Ctrl_Keys : array['A'..'Z'] of Byte
= (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,
23,24,25,26);
TYPE
Str30 = String[30];
PathType = String[255];
BytePtr = ^BYTE;
PtrRec = RECORD
Ofs,
Seg : WORD;
END;
ProtocolRec = record
Up,
Down : PathType;
Name : String[30];
Flag : Integer;
end;
ProtoArray = array['A'..'G'] of ProtocolRec;
FonBookRec = record
Name : Str30;
Number : Str30;
BaudRate : Word;
Parity : Char;
DataBits : Integer;
StopBits : Integer;
end;
FonBookArray = Array[1..Max] of FonBookRec;
MacrosRec = record
Home_Key,
End_Key,
Up_Key,
Down_Key,
Left_Key,
Right_Key,
PageUp_Key,
PageDown_Key,
Ins_Key,
Del_Key : String;
end;
ConfigRec = record
BaudRate : Word; (* Baud rate for connection, e.g., 1200 *)
ComPort : Integer; (* Which port, e.g., 1 for COM1: *)
Parity : Char; (* Parity, e.g., E for even parity *)
DataBits : Integer; (* How many bits per Character, e.g., 8 *)
StopBits : Integer; (* How many stop bits -- nearly always 1 *)
InBufSize : Integer; (* Size of input buffer *)
OutBufSize : Integer; (* Size of output buffer *)
Do_XonXoff : Char; (* 'Y' to do XON/XOFF flow control *)
Do_HardWired : Char; (* 'Y' to do XON/XOFF flow control *)
Do_CTS : Char; (* 'Y' to do CTS/RTS flow control *)
Do_DSR : Char; (* 'Y' to do DSR/DTR flow control *)
Do_Async_Status : Byte; (* Line error reporting off *)
Com_Addr_Str : String[10]; (* Comm port address in hex string *)
Com_Addr : Integer; (* Comm port address *)
Com_Irq : Integer; (* Comm port IRQ address *)
Com_Int_No : Integer; (* Comm port interrupt vector number *)
LocalEcho : Byte;
DirectScreen : Byte;
MuteMode : Byte; (* No Sound *)
LineFeeds : Byte;
ChatMode : Byte;
Protocols : ProtoArray;
FonBook : FonBookArray;
FilesPath : String;
HideStatusBar : Byte;
ToggleBackSpace : Byte;
Macros : MacrosRec;
end;
BufferType = array[1..MaxBuffer] of Char;
BufferRec = Record
BufferArray : BufferType;
BufferCounter : Integer;
BufferFileName : String[12];
BufferStatus : Byte;
end;
VAR
CursorCol : Integer;
CursorRow : Integer;
WindowPtr : Pointer;
(************************************************************************)
{$I suninc.inc}
(************************************************************************)
PROCEDURE GetInt(VAR Number : Integer;
Mode : Byte);
VAR ExitOK : Boolean;
Str6 : String[6];
Num : LongInt;
X : Integer;
begin
ExitOK := FALSE;
Str6 := ' ';
repeat
case Mode of
0 : readln(Str6);
1 : read(Str6);
end; {Case}
val(Str6,Num,X);
if (Num <= 32767) and (Num >= -32767)
then ExitOK := TRUE;
until ExitOK = TRUE;
Number := Num;
end;
(************************************************************************)
PROCEDURE GetChar(VAR Chars : Char;
Mode : Integer);
begin
case Mode of
0 : Chars := Readkey;
1 : readln(Chars);
2 : read(Chars);
end; {case}
Chars := upcase(Chars);
end;
(************************************************************************)
PROCEDURE GetStr(VAR TempStr : String;
Mode : Integer);
begin
case Mode of
0 : readln(TempStr);
1 : read(TempStr);
end; {case}
end;
(************************************************************************)
PROCEDURE Clear_Config(VAR Config : ConfigRec);
VAR Lcv : Integer;
Counter : Char;
begin
with Config do
begin
for Counter := 'A' to 'G' do
begin
Protocols[Counter].Up := ' ';
Protocols[Counter].Down := ' ';
Protocols[Counter].Name := ' ';
Protocols[Counter].Flag := Off;
end;
for Lcv := 1 to Max do
begin
with FonBook[Lcv] do
begin
Name := ' ';
Number := ' ';
BaudRate := 1200;
Parity := 'N';
DataBits := 8;
StopBits := 1;
end;
end;
BaudRate := 1200; (* Baud rate for connection, e.g., 1200 *)
ComPort := 1; (* Which port, e.g., 1 for COM1: *)
Parity := 'N'; (* Parity, e.g., E for even parity *)
DataBits := 8; (* How many bits per Character, e.g., 8 *)
StopBits := 1; (* How many stop bits -- nearly always 1 *)
InBufSize := 1024; (* Size of input buffer *)
OutBufSize := 1024; (* Size of output buffer *)
Do_XonXoff := 'N'; (* 'Y' to do XON/XOFF flow control *)
Do_HardWired := 'N'; (* 'Y' to do XON/XOFF flow control *)
Do_CTS := 'N'; (* 'Y' to do CTS/RTS flow control *)
Do_DSR := 'N'; (* 'Y' to do DSR/DTR flow control *)
Do_Async_Status := Off; (* Line error reporting off *)
Com_Addr_Str := '02e8'; (* Comm port address in hex string *)
Com_Addr := Hex_To_Dec( Com_Addr_Str , -1 );
(* Comm port address *)
Com_Irq := 4; (* Comm port IRQ address *)
Com_Int_No := -1; (* Comm port interrupt vector number *)
(* Use -1 if Not Sure *)
LocalEcho := Off;
DirectScreen := On;
MuteMode := Off; (* No Sound *)
LineFeeds := Off;
ChatMode := Off;
FilesPath := 'C:\programs';
HideStatusBar := Off;
ToggleBackSpace := Off;
with Macros do
begin
Home_Key := ' ';
End_Key := ' ';
Up_K